mobs, round, round_time, old_round = [], 1, Time.new - 1, 1

DownstreamHook.add('kill_room_ds', Proc.new {|ss|
  if Time.new > round_time + 1.75 && ss =~ /(?:scratches|grazes|bruises|scars|wounds|injured|hospital|bleeding lightly|death's door)\.$/
    round += 1
    round_time = Time.new
  end
  ss
})
before_dying {DownstreamHook.remove('kill_room_ds')}

mob_list = get_con(true)[0]
while (mob_info = mob_list.shift)
  next if mob_info[1] > 21 or mob_info[1] < -2
  mob = mob_info[0].clean_colors
  mob = mob.gsub(/(?:\s|^)(an?|the|of|to|on)(?=\s)/i, ' ').gsub(/,/, '').gsub(/\s+/,' ')
  mob =~ /\)?\s\s?([^\)]+)$/i
  break if mob.nil?
  put "k #{$1}"
  wait_until {!Char.enemy.empty?}
  while !Char.enemy.empty?
    (sleep 0.1;next) if old_round == round
    if Char.percent_hp < 60
      put("get 'blue extract' bag", "drink 'blue extract'")
    else
      put 'g'
    end
    old_round = round
  end
  put 'su', 'su'
  tell_wait('su_done')
  put("get 'blue extract' bag", "drink 'blue extract'") if Char.percent_hp < 70
  mob_list = get_con(true)[0]
end